<?php
//include 'phpQuery-onefile.php';
//header('Content-Type: text/html; charset=UTF-8');

class ShanghChangDetail{
	
	function savePageDetail($url){
		phpQuery::newDocumentFile($url);
		$content = pq('.content td:eq(0) span:eq(0)');
		$useful_info_array =  array();
		$str = $content->html();
		$infoList = explode("<br>", $str);
		foreach($infoList as $info){
			if(strlen($info)>0){
				$temp = strip_tags($info);
				$useful_info_array[] = $temp;
			}
		}
		//print_r($useful_info_array);
		$title = $useful_info_array[0];
		//mb_internal_encoding("UTF-8");
		//echo mb_detect_encoding($useful_info_array[1]);
		/**
		$maohao = '：';
		$tmp_arr = explode($maohao,$useful_info_array[1]);
		$brand = $tmp_arr[1];
		$tmp_arr = explode($maohao,$useful_info_array[2]);
		$dur_time= $tmp_arr[1];
		$tmp_arr = explode($maohao,$useful_info_array[3]);
		$location = $tmp_arr[1];
		$tmp_arr = explode($maohao,$useful_info_array[4]);
		$address = $tmp_arr[1];
		$description = $useful_info_array[5];
		*/
		$all = '';
		$i = 0;
		foreach($useful_info_array as $useinfo){
			
			if($i!=0){
				$all = $all."<br>".$useinfo;
			}
				$i = $i + 1;
		}
		$mysqlHelper = MySqlHelperGb::getInstance();
		$sql="insert into act_detail(title,origi_msg,create_time) values('%s','%s','%s')";
		$date = date('Y-m-d H:i:s');
		$sql = sprintf($sql,$title,addslashes($all),$date);//stripslashes
		//echo $sql;
		$mysqlHelper->query($sql);
		return $mysqlHelper->insert_id();
	}
}

?>